/*
 *	The characterio program counts lines, words, and characters in input.
 *	Copyright (C) 1989-2089 Sergey Sergeevich Tsybanov All Rights Reserved
 *
 *	Characterio is free software: you can redistribute it and/or modify 
 *	it under the terms of the GNU General Public License as published 
 *	by the Free Software Foundation, either version 3 of the License, 
 *	or (at your option) any later version.
 *
 *	Characterio is distributed in the hope that it will be useful, but 
 *	WITHOUT ANY WARRANTY; without even the implied warranty of 
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 *	See the GNU General Public License for more details.
 *
 *	You should have received a copy of the GNU General Public License 
 *	along with the characterio program. 
 *	If not, see <https://www.gnu.org/licenses/>.
 */

#include <stdio.h>

/*
 *	IN marks the inside of a word string.
 */
#define IN 1

/*
 * 	OUT marks the outside of a word string.
 */
#define OUT 0

/*
 *	Count lines, words, and characters in input.
 */
int main( void)
{
	char byte, state = OUT;
	long charCount, lineCount, wordCount;
	charCount = lineCount = wordCount = 0;

	if ( ( byte = getchar()) != EOF) {
		++lineCount;
		++charCount;
		while ( (  byte = getchar()) != EOF) {
			++charCount;
			if ( byte == '\n')
				++lineCount;
			if ( byte == ' ' || byte == '\n' || byte == '\t')
				state = OUT;
			else if ( state == OUT) {
				state = IN;
				++wordCount;
			}
		}
	}

	printf( "\nCharacters: %ld Lines: %ld Words: %ld\n",
		charCount, lineCount, wordCount);

	return 0;
}